home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1997-03-30 | 7.3 KB | 249 lines |
- 10 'MOONTRAC - Coordinates of the Moon - 19 MAR 97 rev.30 MAR 97
- 20 KEY OFF
- 30 IF EX$=""THEN EX$="EXIT"
- 40 COLOR 7,0,1
- 50 PI=3.14159
- 60 P5=2*PI 'Radians per Cycle
- 70 D5=360/P5 'Constant for conversion to Degrees
- 80 R5=P5/360 'Constant for conversion to Radians
- 90 '
- 100 '.....start
- 110 CLS:COLOR 15,2
- 120 PRINT " MOON TRACKER";TAB(55)"by Lance Collister WA1JXN ";
- 130 PRINT STRING$(80,32);
- 140 LOCATE CSRLIN-1,20:PRINT "edited for HAMCALC by George Murphy VE3ERP"
- 150 COLOR 1,0:PRINT STRING$(80,223);:COLOR 7,0
- 160 GOSUB 1990 'preface
- 170 COLOR 0,7:LOCATE 25,21
- 180 PRINT " Press 1 to RUN program or 0 to EXIT....";:COLOR 7,0
- 190 Z$=INKEY$:IF Z$=""THEN 190
- 200 IF Z$="0"THEN CLS:RUN EX$
- 210 IF Z$="1"THEN 230
- 220 GOTO 190
- 230 VIEW PRINT 4 TO 24:CLS:VIEW PRINT:LOCATE 4
- 240 PRINT " ENTER: Your latitude in decimal degrees (+<UNK! {00F8}> if North, -<UNK! {00F8}> if South)";
- 250 INPUT L5:L5=L5*R5 'latitude in radians
- 260 PRINT " ENTER: Your longitude in decimal degrees (+<UNK! {00F8}> if East, -<UNK! {00F8}> if West) ";
- 270 INPUT L6:L6=-L6*R5 'longitude in radians
- 280 LTN=INT(L6*180/PI/15)*100 'UTC time adjustment to local time
- 290 I=30 'displayed time increment in minutes
- 300 I6=90 'maximum elevation to be calculated
- 310 INPUT " ENTER: Year (4 digits)...";Y(1)
- 320 INPUT " ENTER: Month number......";F(1)
- 330 INPUT " ENTER: Day number........";V(1)
- 340 N5=1
- 350 FOR N=1 TO N5
- 360 E1=2400
- 370 B=0
- 380 Y=Y(N):Y$=STR$(Y):Y$=RIGHT$(Y$,LEN(Y$)-1)
- 390 M=F(N):M$=STR$(M):M$=RIGHT$(M$,LEN(M$)-1)
- 400 D=V(N):D$=STR$(D):D$=RIGHT$(D$,LEN(D$)-1)
- 410 PRINT
- 420 CLS
- 430 LA=L5*180/PI:LO=L6*180/PI
- 440 IF LA<0 THEN LA$="S"ELSE LA$="N"
- 450 IF LO<0 THEN LO$="E"ELSE LO$="W"
- 460 PRINT " POSITION OF THE MOON on ";Y$;"/";M$;"/";D$;" GMT as seen from";
- 470 PRINT USING "####.#<UNK! {00F8}>";LA;:PRINT LA$;
- 480 PRINT USING "####.#<UNK! {00F8}>";LO;:PRINT LO$
- 490 PRINT STRING$(80,205);
- 500 PRINT " LST = Local Solar Time; <UNK! {00F7}>y = yesterday; <UNK! {00F7}>t = tomorrow"
- 510 PRINT STRING$(80,205);
- 520 PRINT " GMT"TAB(12)"GHA"TAB(20)"DECLIN"TAB(29)"WINDOW"TAB(41)"LST";
- 530 PRINT TAB(49)"AZIMUTH"TAB(59)"ELEVATION
- 540 PRINT STRING$(67,196);
- 550 I1=2
- 560 IF M>=3 THEN 640 'Julian Date Calculation
- 570 IF INT((Y-1853)/4)<11 THEN 600
- 580 C1=-1
- 590 GOTO 610
- 600 C1=0
- 610 J1=365*(Y-1853)+D+30*(M+9)+INT((M+10)/2)
- 620 J2=INT((Y-1853)/4)+1+C1
- 630 GOTO 750
- 640 IF INT((Y-1852)/4)<11 THEN 670
- 650 C1=-1
- 660 GOTO 680
- 670 C1=0
- 680 IF M=9 THEN 720
- 690 IF M=11 THEN 720
- 700 C2=0
- 710 GOTO 730
- 720 C2=1
- 730 J1=365*(Y-1852)+D+30*(M-3)+INT((M-2)/2)
- 740 J2=INT((Y-1852)/4)+C1+C2
- 750 J=J1+J2 'Julian Date
- 760 T1=J-17472.5
- 770 '
- 780 '.....compute a row of data
- 790 D9=(B-INT(B/100)*100)+INT(B/100)*60
- 800 D6=(E1-INT(E1/100)*100)+INT(E1/100)*60
- 810 D7=D9-D6
- 820 D8=D7-I
- 830 IF D7>0 THEN 850
- 840 GOTO 870
- 850 IF D8>=0 THEN 1940
- 860 B=E1
- 870 T=(B-INT(B/100)*100)/1440+INT(B/100)/24 'Calc of moon lat and long
- 880 T5=T1+T
- 890 K1=((0.751213+0.0366011*T5)-INT(0.751213+0.0366011*T5))*P5
- 900 K2=((0.822513+0.0362916*T5)-INT(0.822513+0.0362916*T5))*P5
- 910 K3=((0.995766+0.00273778*T5)-INT(0.995766+0.00273778*T5))*P5
- 920 K4=((0.974271+0.0338632*T5)-INT(0.974271+0.0338632*T5))*P5
- 930 K5=((0.0312525+0.0367482*T5)-INT(0.0312525+0.0367482*T5))*P5
- 940 L8=K1+0.658*R5*SIN(2*K4)+6.289*R5*SIN(K2)
- 950 L8=L8-1.274*R5*SIN(K2-2*K4)-0.186*R5*SIN(K3)
- 960 L8=L8+0.214*R5*SIN(2*K2)-0.114*R5*SIN(2*K5)
- 970 L8=L8-0.059*R5*SIN(2*K2-2*K4)-0.057*R5*SIN(K2+K3-2*K4)
- 980 K6=K5+0.6593*R5*SIN(2*K4)+6.2303*R5*SIN(K2)-1.272*R5*SIN(K2-2*K4)
- 990 L7=5.144*R5*SIN(K6)-0.146*R5*SIN(K5-2*K4)
- 1000 '.....Calc of right ascension (A=R1) and Declination (D1)
- 1010 D1=COS(L7)*SIN(L8)*0.397821+SIN(L7)*0.917463
- 1020 D1=ATN(D1/(SQR(1-D1^2)))
- 1030 G1=50.5+((D1/0.729))*D5 'Test for start of EUROPEAN window
- 1040 G2=80+((D1)/(0.808))*D5 'Test for start AMERICAS end EUROPEAN
- 1050 G3=141.5-((D1)*(0.738)*D5) 'Test for start FAR EASTERN end AMERICAS
- 1060 G4=170.5-((D1)*(0.857)*D5) 'Test for end of FAR EASTERN window
- 1070 A2=COS(L7)*COS(L8)/COS(D1)
- 1080 A1=(COS(L7)*SIN(L8)*0.917463-SIN(L7)*0.397821)/COS(D1)
- 1090 A=ATN(A1/A2)
- 1100 GOSUB 1360
- 1110 R1=A
- 1120 L1=0.0657098*T1
- 1130 L=T*24*1.00274+6.64606+(L1-INT(L1/24)*24)
- 1140 L=(L-INT(L/24)*24)
- 1150 G=(L/24)*P5-R1 'Calc of Greenwich Hour Angle, G, from local sidereal time
- 1160 IF G<P5 THEN 1190
- 1170 G=G-P5
- 1180 GOTO 1220
- 1190 IF G<0 THEN 1210
- 1200 GOTO 1220
- 1210 G=G+P5
- 1220 H=L6-G 'Calc of your Local Hour Angle, H, from GHA
- 1230 E3=COS(L5)*COS(H)*COS(D1)+SIN(D1)*SIN(L5) 'Calc of Elevation, E
- 1240 E2=SQR(1-E3^2)
- 1250 E=ATN((E3/E2)-(1/(61.33*E2)))
- 1260 F=ATN(E3/E2)
- 1270 IF E<0 THEN 1890
- 1280 IF E>I6*R5 THEN 1890
- 1290 A2=SIN(D1)/(COS(L5)*COS(F)) 'Calc of Azimuth, A
- 1300 A2=A2-(SIN(L5)/COS(L5))*(SIN(F)/COS(F)) 'cos AZ
- 1310 A1=SIN(L5)*SIN(D1)+COS(L5)*COS(D1)*COS(H)
- 1320 A1=(SIN(H)*COS(D1))/SQR(1-A1^2) 'sin AZ
- 1330 A=ATN(A1/A2) 'azimuth=arctan(sin/cos)
- 1340 GOSUB 1360
- 1350 GOTO 1510
- 1360 IF A=0 THEN 1380 'Begin removal of ambiguities incurred using ATN function
- 1370 GOTO 1420
- 1380 IF A2<0 THEN 1400
- 1390 GOTO 1500
- 1400 A=P5/2
- 1410 GOTO 1500
- 1420 IF A>0 THEN 1480
- 1430 IF A2<0 THEN 1460
- 1440 A=P5+A
- 1450 GOTO 1500
- 1460 A=P5+(A-P5/2)
- 1470 GOTO 1500
- 1480 IF A2>=0 THEN 1500
- 1490 A=A+P5/2
- 1500 RETURN
- 1510 IF (T-11)>(2*I)/1440 THEN 1530
- 1520 GOTO 1540
- 1530 PRINT
- 1540 BS=CINT(B) 'GMT
- 1550 Z1=CINT(A*D5*10)/10 'AZ
- 1560 Z2=CINT(E*D5*10)/10 'EL
- 1570 Z3=CINT(G*D5*10)/10 'GHA
- 1580 Z4=CINT(D1*D5*10)/10 'DEC
- 1590 IF Z4<0 THEN 1720 'Begin tests for possible Universal Windows
- 1600 IF Z3<G1 THEN 1720
- 1610 IF Z3>G2 THEN 1630
- 1620 GOTO 1660
- 1630 IF Z3<G3 THEN 1680
- 1640 IF Z3>G4 THEN 1720
- 1650 GOTO 1700
- 1660 Y$="European" 'European to Americas window, EU-W
- 1670 GOTO 1730
- 1680 Y$="Americas" 'Americas universal window, W-W
- 1690 GOTO 1730
- 1700 Y$="Far East" 'Far Eastern to Americas window, JA-VK-ZL
- 1710 GOTO 1730
- 1720 Y$=" "
- 1730 ES=CINT(B)-LTN 'Local time adjustment
- 1740 E$=""
- 1750 IF ES<0 THEN ES=ES+2400:E$=" <UNK! {00F7}>y"
- 1760 IF ES>2400 THEN ES=ES-2400:E$=" <UNK! {00F7}>t"
- 1770 N$="###.#<UNK! {00F8}>"
- 1780 BS$=STR$(BS):BS$=RIGHT$(BS$,LEN(BS$)-1)
- 1790 IF LEN(BS$)<4 THEN BS$="0"+BS$:GOTO 1790
- 1800 ES$=STR$(ES):ES$=RIGHT$(ES$,LEN(ES$)-1)
- 1810 IF LEN(ES$)<4 THEN ES$="0"+ES$:GOTO 1810
- 1820 ES$=LEFT$(ES$,2)+":"+RIGHT$(ES$,2)
- 1830 PRINT TAB(2) BS$;:PRINT TAB(10) USING N$;Z3;:PRINT TAB(20) USING N$;Z4;
- 1840 PRINT TAB(28) Y$;:PRINT TAB(40) ES$+E$;:PRINT TAB(50) USING N$;Z1;
- 1850 PRINT TAB(60) USING N$;Z2;
- 1860 LN=CSRLIN:IF LN<24 THEN PRINT "":GOTO 1880
- 1870 GOSUB 2360:CLS
- 1880 I1=T
- 1890 B=B+I
- 1900 Z=(B-INT(B/100)*100)-60
- 1910 IF Z<0 THEN 780
- 1920 B=INT(B/100)*100+100+Z
- 1930 GOTO 780 'compute next row of data
- 1940 NEXT N
- 1950 PRINT STRING$(67,196)
- 1960 N=0
- 1970 GOSUB 2360:GOTO 100
- 1980 '
- 1990 '.....preface
- 2000 TB=7
- 2010 PRINT TAB(TB);
- 2020 PRINT "Displays GHA, Declination, Azimuth and Elevation of the moon from a"
- 2030 PRINT TAB(TB);
- 2040 PRINT "selected latitude and longitude on a selected date. 'Windows'"
- 2050 PRINT TAB(TB);
- 2060 PRINT "between the Western Hemisphere and other parts of the world are"
- 2070 PRINT TAB(TB);
- 2080 PRINT "also indicated where appropriate."
- 2090 PRINT
- 2100 PRINT TAB(TB);
- 2110 PRINT "Position is calculated at 30 minute intervals during the portions"
- 2120 PRINT TAB(TB);
- 2130 PRINT "of the GMT day when the moon is above the local horizon."
- 2140 PRINT
- 2150 PRINT TAB(TB);
- 2160 PRINT "Latitude and longitude are computed in decimal degrees. If you wish"
- 2170 PRINT TAB(TB);
- 2180 PRINT "to convert degree/minute/second coordinates to decimal degrees, run"
- 2190 PRINT TAB(TB);
- 2200 PRINT "the EQUIVALENT VALUES program."
- 2210 PRINT
- 2220 PRINT TAB(TB);
- 2230 PRINT "If you are making a printout, select option (1) from the printer"
- 2240 PRINT TAB(TB);
- 2250 PRINT "control message bar at the bottom of each screen (i.e., DO NOT"
- 2260 PRINT TAB(TB);
- 2270 PRINT "advance paper) if you want a single continuous tabular printout."
- 2280 PRINT TAB(TB);
- 2290 PRINT
- 2300 PRINT TAB(TB);
- 2310 PRINT "(For further information see the 1997 ARRL HANDBOOK for RADIO"
- 2320 PRINT TAB(TB);
- 2330 PRINT "AMATEURS, page 23.55).
- 2340 RETURN
- 2350 '
- 2360 'HARDCOPY
- 2370 GOSUB 2480:LOCATE 25,2:COLOR 14,6
- 2380 PRINT " Press 1 to print screen, 2 to print screen & ";
- 2390 PRINT "advance paper, or 3 to continue.";:COLOR 7,0
- 2400 Z$=INKEY$:IF Z$="3"THEN GOSUB 2480:RETURN
- 2410 IF Z$="1"OR Z$="2"THEN GOSUB 2480:GOTO 2430
- 2420 GOTO 2400
- 2430 FOR QX=1 TO 24:FOR QY=1 TO 80
- 2440 LPRINT CHR$(SCREEN(QX,QY));
- 2450 NEXT QY:NEXT QX
- 2460 IF Z$="2"THEN LPRINT CHR$(12)
- 2470 GOTO 2370
- 2480 LOCATE 25,1:PRINT STRING$(80,32);:RETURN
-